//-----------------------------------------------------------------------------
// Bend2D - Physics Engine
// Roberto Bender <beto.bender@gmail.com>
// Description: 
// Date: 11/03/2010
//-----------------------------------------------------------------------------
#ifndef BMATH_H
#define BMATH_H

#include "point.h"
#include "rectangle.h"
#include "angle.h"
#include "line.h"

#include <sstream>
using namespace std;

namespace bend2d
{
    class Math 
    {
        public:
            enum eRWConvertType
            {
                mps2,
            };
            // Conversions //
            static double ConvertRWToBend2D(double value, eRWConvertType);
            static void ConvertToBinary(unsigned int value, unsigned int size, string& retvalue);

            // Simple Geometry //
            static double CalculateVolume(const Rectangle& rectangle);
            static double CalculatePerimeter(const Rectangle& rectangle);
            static double Sin(const Angle& angle);
            static double Cos(const Angle& angle);
            static void ApplySin(const Angle& angle, double& value);
            static void ApplyCos(const Angle& angle, double& value);
            static Angle ArcSin(double value);
            static Angle ArcCos(double value);
            static Angle ArcTg(double value);
            static double Sqrt(double value);
            static double Pow(double value, double p);
            static double Abs(double value);

            // Complex Geometry //
            static bool IsIn(const Point& point, const Rectangle& rectangle);
            static bool IsIn(const Rectangle& rectangleA, const Rectangle& rectangleB);
            static bool IsIn(const Point& point, const Line& line, double error = 0);
            static bool CanMerge(const Rectangle& rectangleA, const Rectangle& rectangleB);
            static bool Cross(Line& a, Line& b, Point& position, double radius = 0.1);
            static void ConvertLineToPoint(const Line& line, Point& point);

            // Constants //
            static double pi;
            static double max_Acceleration;
            static double max_Speed;
        private:
    };
}

#endif
